--[[/**
-- * 
 * 每次扣血
-- *
-- */]]

---@class BuffEffect485101 : BaseBuffEffect
BuffEffect485101 = ClientFight.CreateClass("BuffEffect485101", ClientFight.BaseBuffEffect)
local t = BuffEffect485101

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    if (table.getn(parameters) < 1)then
    return IBuffEffect.FAIL;
    end
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    local oldVlaue = buff.attributes.attributes[FighterAttributeEnum.ENERGY_COST.id] or 0;
    if (oldVlaue >= buffEffectValue[2])then
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
    .. buff.modelId .. " 触发降低sp消耗失败, 已减免值达到上限: " .. oldVlaue);
    return IBuffEffect.FAIL;
    end
    local totalValue = oldVlaue + buffEffectValue[1];
    if (totalValue >= buffEffectValue[2]) then
    totalValue = buffEffectValue[2];
    end
    local logValue = totalValue;
    buff.attributes.attributes[FighterAttributeEnum.ENERGY_COST.id] = totalValue; --减免多少 sp消耗
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
    .. buff.modelId .. " 触发sp消耗成功, 当前总减免值: " .. logValue );
    ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
    return IBuffEffect.SUCCESS_ATTRI_HAS_CHANGE;
end

t.New()